package com.itheima.api.mathdemo;

public class IntegerDemo {
    public static void main(String[] args) {
        //按照空格字符串进行切割得到字符串处数组
        String s = "81 54 65 2 1 52 1314";
        String[] split = s.split("");
        //创建长度和字符串数组相同的数组用来存储转换后的int值
        int[] arr = new int[split.length];
        //遍历字符串数组
        for (int i = 0; i < split.length; i++) {
            //转换为int值,并赋值给int数组
           arr[i] = Integer.parseInt(split[i]);
        }
        //遍历打印数组
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + "");

        }
    }
}
